package wordCount;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

/**
 * @author teng1
 */
public class wordCountMapper extends Mapper<LongWritable, Text, Text, LongWritable> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        Text k = new Text();
        LongWritable v = new LongWritable(1);
        // 把每一行的单词划分
        final String[] words = value.toString().split("");
        for (String word : words) {
            k.set(word);
            context.write(k, v);
        }

    }
}
